package com.dstation.config;

import com.dstation.interceptor.AdminLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SystemConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 1. 管理员全部的请求都要经过拦截器
        InterceptorRegistration registration = registry.addInterceptor(new AdminLoginInterceptor());
        registration.addPathPatterns("/admin/**");
        // 获得登录界面不需要拦截,admin的全部资源不需要拦截 js css html,以及登录界面的请求
        registration.excludePathPatterns("/admin/loginPage",
                "/admin/generateVertifyCode",
                "/admin/queryAdminInfo",
                "admin/setLabels",
                "/admin/loginPage");
    }


}
